import request from '@/utils/request'

// 搜索酒店
export function searchHotels(params) {
  return request({
    url: '/api/hotels/search',
    method: 'get',
    params
  })
}

// 获取酒店详情
export function getHotelById(id) {
  return request({
    url: `/api/hotels/${id}`,
    method: 'get'
  })
}

// 获取推荐酒店
export function getRecommendedHotels(userId, limit = 5) {
  return request({
    url: '/api/hotels/recommended',
    method: 'get',
    params: { userId, limit }
  })
}

// 获取相似酒店
export function getSimilarHotels(hotelId, limit = 5) {
  return request({
    url: '/api/hotels/similar',
    method: 'get',
    params: { hotelId, limit }
  })
}

// 创建预订
export function createBooking(data) {
  return request({
    url: '/api/hotels/bookings',
    method: 'post',
    data
  })
}

// 获取预订详情
export function getBookingById(bookingId) {
  return request({
    url: `/api/hotels/bookings/${bookingId}`,
    method: 'get'
  })
}

// 获取用户预订列表
export function getUserBookings(userId, params) {
  return request({
    url: `/api/hotels/bookings/user/${userId}`,
    method: 'get',
    params
  })
}

// 取消预订
export function cancelBooking(bookingId) {
  return request({
    url: `/api/hotels/bookings/${bookingId}/cancel`,
    method: 'post'
  })
}

// 获取房型价格
export function getRoomPrice(roomId, checkInDate, checkOutDate) {
  return request({
    url: '/api/hotels/rooms/price',
    method: 'get',
    params: { roomId, checkInDate, checkOutDate }
  })
}

// 检查房型可用性
export function checkRoomAvailability(roomId, checkInDate, checkOutDate) {
  return request({
    url: '/api/hotels/rooms/availability',
    method: 'get',
    params: { roomId, checkInDate, checkOutDate }
  })
}

// 获取入住率预测
export function getOccupancyPrediction(hotelId, date) {
  return request({
    url: '/api/hotels/occupancy/prediction',
    method: 'get',
    params: { hotelId, date }
  })
}

// 获取信用优惠信息
export function getCreditBenefits(userId, hotelId) {
  return request({
    url: '/api/hotels/credit/benefits',
    method: 'get',
    params: { userId, hotelId }
  })
}

// 检查免押金资格
export function checkDepositFree(userId, hotelId) {
  return request({
    url: '/api/hotels/credit/deposit-free',
    method: 'get',
    params: { userId, hotelId }
  })
}

// 获取房价折扣
export function getPriceDiscount(userId, hotelId) {
  return request({
    url: '/api/hotels/credit/price-discount',
    method: 'get',
    params: { userId, hotelId }
  })
}

// 获取酒店评价
export function getHotelReviews(hotelId, params) {
  return request({
    url: `/api/hotels/${hotelId}/reviews`,
    method: 'get',
    params
  })
}

// 提交酒店评价
export function submitHotelReview(data) {
  return request({
    url: '/api/hotels/reviews',
    method: 'post',
    data
  })
}

// 获取酒店设施
export function getHotelFacilities(hotelId) {
  return request({
    url: `/api/hotels/${hotelId}/facilities`,
    method: 'get'
  })
}

// 获取酒店政策
export function getHotelPolicies(hotelId) {
  return request({
    url: `/api/hotels/${hotelId}/policies`,
    method: 'get'
  })
}

// 获取酒店周边信息
export function getHotelSurroundings(hotelId) {
  return request({
    url: `/api/hotels/${hotelId}/surroundings`,
    method: 'get'
  })
}

// 获取酒店交通信息
export function getHotelTransportation(hotelId) {
  return request({
    url: `/api/hotels/${hotelId}/transportation`,
    method: 'get'
  })
} 